package cn.jetpiece.cloud.system.dp.app.enums;

import java.util.ArrayList;
import java.util.List;

/**
 *
 */
public enum DataSourceEnum {

    SELF(1, "自建"),

    OMS(2, "OMS");

    private Integer code;

    private String desc;

    DataSourceEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDescByCode(String code) {
        DataSourceEnum[] planFileTypeEnums = getAll();
        for (DataSourceEnum planFileTypeEnum : planFileTypeEnums) {
            if (planFileTypeEnum.code.equals(code)) {
                return planFileTypeEnum.desc;
            }
        }
        return null;
    }


    public static DataSourceEnum[] getAll() {
        return cache.sourceType;
    }

    private static class cache {
        private static final DataSourceEnum[] sourceType = DataSourceEnum
                .values();
    }

    /**
     * @Description: 数据来源信息查询
     * @Date: 2021/2/2 14:07
     */
    public static List<Integer> getQuerySources() {
        List<Integer> sources = new ArrayList<>();
        sources.add(Integer.valueOf(DataSourceEnum.SELF.getCode()));
        sources.add(Integer.valueOf(DataSourceEnum.OMS.getCode()));
        return sources;
    }
}
